//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#include <core.h>
#include <mantle.h>

#include "ccartst.h"
#include <stub.h>
#include <syscall.h>

PInterface CKCarTst::Probe(
    /* [in] */ REIID riid)
{
    if (riid == EIID_IInterface) {
        return (PInterface)(IKCarTst *)this;
    }
    else if (riid == EIID_IKCarTst) {
        return (IKCarTst *)this;
    }
    else if (riid == EIID_CLASS_INFO) {
        return (PInterface)&ECLSID_CKCarTst;
    }
    else if (riid == EIID_INTERFACE_INFO) {
        return (PInterface)&EIID_IKCarTst;
    }

    return NULL;
}

UInt32 CKCarTst::AddRef(void)
{
    return (UInt32)InterlockedIncrement(&m_Ref);
}

UInt32 CKCarTst::Release(void)
{
    int c = InterlockedDecrement(&m_Ref);
    if (c == 0) {
        delete this;
    }
    return c;
}

ECode CKCarTst::Aggregate(
    /* [in] */ AggregateType type,
    /* [in] */ PInterface pObj)
{
    return E_NOT_IMPLEMENTED;
}

ECode CKCarTst::GetDomain(
    /* [out] */ PInterface *ppObj)
{
    return E_NOT_IMPLEMENTED;
}

ECode CKCarTst::CarTst0()
{
    return NOERROR;
}

ECode CKCarTst::CarTst1(/*[in]*/ WString para)
{
    return NOERROR;
}

ECode CKCarTst::CarTst2(/*[out]*/ WStringBuf * para)
{
    para->Copy(L"Hello, World!");
    return NOERROR;
}

ECode CKCarTst::CarTst3(/*[in]*/ const BufferOf<Int32> & para)
{
    return NOERROR;
}

ECode CKCarTst::CarTst4(/*[out]*/ BufferOf<Int32> * para)
{
    (*para)[0] = 1;
    return NOERROR;
}

ECode CKCarTst::CarTst5(/*[in]*/ int para)
{
    return NOERROR;
}

ECode CKCarTst::CarTst6(/*[out]*/ int * para)
{
    *para = 0;
    return NOERROR;
}

ECode CKCarTst::CarTst7(/*[in]*/ IInterface * para)
{
    return NOERROR;
}

ECode CKCarTst::CarTst8(/*[out]*/ IInterface ** para)
{
    *para = (PInterface)(IKCarTst *)this;
    this->AddRef();
    return NOERROR;
}

ECode CKCarTst::CarTst9(/*[in]*/ const BufferOf<Byte> & para)
{
    return NOERROR;
}
